package com.audaque.springboot.foshanupload.web.servletdemo.controller;

import com.audaque.springboot.foshanupload.web.servletdemo.model.Poc;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet(name = "fastJsonServlet", urlPatterns = "/servlet/fastJson")
public class FastJsonServlet extends HttpServlet {

    public void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        String rootPath = request.getSession().getServletContext().getRealPath("");
        Object obj = Poc.run(rootPath);
        PrintWriter out = response.getWriter();
        out.println(obj);
    }

}
